package versi.vitro.oaiserviceprovider.service.validation.impl;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import versi.vitro.oaiserviceprovider.service.transformer.api.TransformerService;
import versi.vitro.oaiserviceprovider.test.BaseTestCase;

public class TransformerServiceIntegrationTest extends BaseTestCase {
    
    private String sourceXmlLocation = "test.xml";
    private String sourceXml;
    
    private String transformXmlLocation = "test.xsl";
    private String transformXml;

    @BeforeClass
    public void setUp() {
	sourceXml = getGeneralHelper().readPackageResourceAsString(sourceXmlLocation, getClass());
	transformXml = getGeneralHelper().readPackageResourceAsString(transformXmlLocation, getClass());
    }
    
    @Test
    public void testRdfToXmlTransformation()
    {
	TransformerService transformerService = getTransformerService();
	byte[] rdfXml = sourceXml.getBytes();
	byte[] xslts = transformXml.getBytes();
	byte[] transformedBytes = transformerService.applyXSLT(rdfXml, xslts);
	
	assert new String(transformedBytes).contains("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    }
}
